--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 3d0043499cc9a70821957c5cc8a520aa7892282b
Parents : b6e6c4b
Author : Mark Qvist <mark@unsigned.io>
Date : 2023-08-13T20:37:44+02:00
Added error handling to lxmf.delivery announce handler. Fixes #30. Hopefully.
Changes
Diff
diff --git a/nomadnet/Directory.py b/nomadnet/Directory.py
index 64eaf07..2cba01b 100644
--- a/nomadnet/Directory.py
+++ b/nomadnet/Directory.py
@@ -34,16 +34,21 @@ class Directory:
aspect_filter = "nomadnetwork.node"
@staticmethod
def received_announce(destination_hash, announced_identity, app_data):
- app = nomadnet.NomadNetworkApp.get_shared_instance()
+ try:
+ app = nomadnet.NomadNetworkApp.get_shared_instance()
- if not destination_hash in app.ignored_list:
- associated_peer = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", announced_identity)
+ if not destination_hash in app.ignored_list:
+ associated_peer = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", announced_identity)
- app.directory.node_announce_received(destination_hash, app_data, associated_peer)
- app.autoselect_propagation_node()
-
- else:
- RNS.log("Ignored announce from "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
+ app.directory.node_announce_received(destination_hash, app_data, associated_peer)
+ app.autoselect_propagation_node()
+
+ else:
+ RNS.log("Ignored announce from "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
+
+ except Exception as e:
+ RNS.log("Error while evaluating LXMF destination announce, ignoring announce.", RNS.LOG_DEBUG)
+ RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
def __init__(self, app):
diff --git a/setup.py b/setup.py
index 2992e60..b5b5fad 100644
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,6 @@ setuptools.setup(
entry_points= {
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
},
- install_requires=["rns>=0.5.5", "lxmf>=0.3.2", "urwid>=2.1.2", "qrcode"],
+ install_requires=["rns>=0.5.7", "lxmf>=0.3.2", "urwid>=2.1.2", "qrcode"],
python_requires=">=3.6",
)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────